package com.sskj.gocoin.p.activity;

import com.lzy.okgo.OkGo;
import com.lzy.okgo.model.Response;
import com.sskj.gocoin.m.HttpConfig;
import com.sskj.gocoin.m.bean.HttpData;
import com.sskj.gocoin.m.http.JsonCallBack;
import com.sskj.gocoin.mine.data.CommonBean;
import com.sskj.gocoin.p.base.BasePresenter;
import com.sskj.gocoin.v.activity.CommonDetail;

public class ShareDetailPresenter extends BasePresenter<CommonDetail> {


    public void getData(int page, int type) {
        OkGo.<HttpData<CommonBean>>get(HttpConfig.BASE_URL + HttpConfig.YUANLI_DETAIL)
                .params("p", page)
                .params(5 == type ? "type1" : "type", type)  //type ==3 推荐原力明细，type不传值所有
                .execute(new JsonCallBack<HttpData<CommonBean>>() {
                    @Override
                    protected void _onSuccess(Response<HttpData<CommonBean>> response) {
                        mView.setData(response.body().getData());
                    }

                    @Override
                    public void onFinish() {
                        super.onFinish();
                        mView.stopRefresh();
                    }
                });
    }

    public void getMX(int page) {
        OkGo.<HttpData<CommonBean>>get(HttpConfig.BASE_URL + HttpConfig.YJMX)
                .params("p", page)
                .execute(new JsonCallBack<HttpData<CommonBean>>() {
                    @Override
                    protected void _onSuccess(Response<HttpData<CommonBean>> response) {
                        mView.setData(response.body().getData());
                    }

                    @Override
                    public void onFinish() {
                        super.onFinish();
                        mView.stopRefresh();
                    }
                });
    }
}
